#!/bin/bash
# 校时
timedatectl set-ntp true
# 分区 -- 人肉
#格式化分区
mkfs.ext4 /dev/sda1
# 挂载分区
mount /dev/sda1 /mnt

# 设置镜像
cat << 'EOF' > /etc/pacman.d/mirrorlist
Server = https://mirrors.sjtug.sjtu.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.neusoft.edu.cn/archlinux/$repo/os/$arch
Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
Server = http://mirror.lzu.edu.cn/archlinux/$repo/os/$arch
Server = http://mirrors.163.com/archlinux/$repo/os/$arch
Server = http://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
Server = http://mirrors.neusoft.edu.cn/archlinux/$repo/os/$arch
EOF

# 建立root文件夹
mkdir -p /mnt/root/
# 配置脚本 移动过去
cp config.sh /mnt/root/config.sh
# 
pacstrap  /mnt base linux base-devel linux-firmware && \
    genfstab -U /mnt >> /mnt/etc/fstab && \
    chmod +x /mnt/root/config.sh && \
    arch-chroot /mnt /root/config.sh && \
    reboot

